using System;
using System.ComponentModel;
using System.Collections.Generic;

using Castle.ActiveRecord;

/// <summary>
/// Business entity class generated from OrderSummary
/// </summary>
/// <remarks>
/// Created by: huanhvhd
/// Created date: [2011-04-23]
/// </remarks>
namespace TVN.ShopMan.ActiveModels
{
	[ActiveRecord("OrderSummary")]
	public partial class OrderSummary : ActiveRecordBase<OrderSummary>
	{
		#region Properties
		
        /// <summary>
        /// All properties
        /// </summary>
		public class Properties
		{
			public const string Id = "Id";
			public const string OrderName = "OrderName";
			public const string CalculationValue = "CalculationValue";
			public const string DiscountValue = "DiscountValue";
			public const string RealValue = "RealValue";
			public const string ActualDate = "ActualDate";
			public const string OrderType = "OrderType";
			public const string CreatedDate = "CreatedDate";
			public const string LastModifiedDate = "LastModifiedDate";
			public const string Creator = "Creator";
			public const string LastModifier = "LastModifier";
			public const string Repository = "Repository";
		}

		#endregion

		#region Private fields

		private int _id;
		private string _orderName;
		private System.Decimal _calculationValue;
		private System.Decimal _discountValue;
		private System.Decimal _realValue;
		private DateTime _actualDate;
		private string _orderType;
		private DateTime _createdDate;
		private DateTime? _lastModifiedDate;
		private Account _creatorId;
		private Account _lastModifierId;
		private Repository _repositoryId;

		private IList<ImportDetail> _importDetailsOrderSummaryId = new List<ImportDetail>();
		private IList<SellDetail> _sellDetailsOrderSummaryId = new List<SellDetail>();

		#endregion

		#region Constructors

		public OrderSummary()
		{
		}

		#endregion

		#region Properties

		[PrimaryKey("Id", Access = PropertyAccess.NosetterLowercaseUnderscore)]
		public int Id
		{
			get { return _id; }
		}

		[Property("OrderName", NotNull = true, Length = 256)]
		public string OrderName
		{
			get { return _orderName; }
			set { _orderName = value; }
		}

		[Property("CalculationValue", NotNull = true)]
		public System.Decimal CalculationValue
		{
			get { return _calculationValue; }
			set { _calculationValue = value; }
		}

		[Property("DiscountValue", NotNull = true)]
		public System.Decimal DiscountValue
		{
			get { return _discountValue; }
			set { _discountValue = value; }
		}

		[Property("RealValue", NotNull = true)]
		public System.Decimal RealValue
		{
			get { return _realValue; }
			set { _realValue = value; }
		}

		[Property("ActualDate", NotNull = true)]
		public DateTime ActualDate
		{
			get { return _actualDate; }
			set { _actualDate = value; }
		}

		[Property("OrderType", NotNull = true, Length = 32)]
		public string OrderType
		{
			get { return _orderType; }
			set { _orderType = value; }
		}

		[Property("CreatedDate", NotNull = true)]
		public DateTime CreatedDate
		{
			get { return _createdDate; }
			set { _createdDate = value; }
		}

		[Property("LastModifiedDate")]
		public DateTime? LastModifiedDate
		{
			get { return _lastModifiedDate; }
			set { _lastModifiedDate = value; }
		}

		[BelongsTo("CreatorId", Type = typeof(Account))]
		public Account Creator
		{
			get { return _creatorId; }
			set { _creatorId = value; }
		}

		[BelongsTo("LastModifierId", Type = typeof(Account))]
		public Account LastModifier
		{
			get { return _lastModifierId; }
			set { _lastModifierId = value; }
		}

		[BelongsTo("RepositoryId", Type = typeof(Repository))]
		public Repository Repository
		{
			get { return _repositoryId; }
			set { _repositoryId = value; }
		}

		[HasMany(typeof(ImportDetail), Table="ImportDetail", ColumnKey="OrderSummaryId")]
		public IList<ImportDetail> ImportDetailsOrderSummaryId
		{
			get { return _importDetailsOrderSummaryId; }
			set { _importDetailsOrderSummaryId = value; }
		}
		[HasMany(typeof(SellDetail), Table="SellDetail", ColumnKey="OrderSummaryId")]
		public IList<SellDetail> SellDetailsOrderSummaryId
		{
			get { return _sellDetailsOrderSummaryId; }
			set { _sellDetailsOrderSummaryId = value; }
		}
		#endregion

	} }
